import os
import shutil
import random

ratio = 1 - 0.3

samples = os.listdir('./clean/OCTA')
random.shuffle(samples)
length = len(samples)

if not os.path.exists('train'):
    os.makedirs('train/OCTA')
    os.makedirs('test/OCTA')

for sample in samples[:int(length * ratio)]:
    shutil.copytree(
        f'clean/OCTA/{sample}',
        f'train/OCTA/{sample}',
    )

shutil.copy(
    'clean/label.csv',
    'train/label.csv',
)

for sample in samples[int(length * ratio):]:
    shutil.copytree(
        f'clean/OCTA/{sample}',
        f'test/OCTA/{sample}',
    )

shutil.copy(
    'clean/label.csv',
    'test/label.csv',
)
